package cn.imu.appdevexperiment2020.Application.activity.jiemian;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.List;

import cn.imu.appdevexperiment2020.Application.bean.DataBean;
import cn.imu.appdevexperiment2020.R;
public class ClassAdapter extends ArrayAdapter<DataBean> {
    private int resourceId;
    public ClassAdapter(@NonNull Context context, int textViewResourceId, @NonNull List<DataBean> objects) {
        super(context, textViewResourceId, objects);
        resourceId=textViewResourceId;
    }
    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        DataBean data=getItem(position);
        TextView userIdtv;
        TextView userNametv;
        TextView nickNametv;
        TextView createBytv;
        View view=LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
        userIdtv= view.findViewById(R.id.class_createBy);
        userNametv= view.findViewById(R.id.class_createtime);
        nickNametv= view.findViewById(R.id.class_email);
        createBytv=view.findViewById(R.id.class_classname);
        userIdtv.setText(data.getCreateBy());
        userNametv.setText(data.getCreateTime());
        nickNametv.setText(data.getEmail());
        createBytv.setText(data.getClassesName());
        return view;
    }
}